package org.NooLab.glue.net.http.rest.resources;


import org.restlet.representation.Representation;
import org.restlet.resource.Get;
import org.restlet.resource.Post;

public class ReceptorStateResource extends BaseResource{

	public ReceptorStateResource(){
		
	}
	
	@Get
	public String DataHandlerGet(){
		
		
		return "1";
	}
	
	@Post 
	public String StateMsgHandlerPost(Representation entity){   
		
		String msgText="" ;
		MessageSupply msgSupply;
		 
		
		msgSupply = prepareMessageRouting();

		try {
												out.print(3,"Restlet-Server (1), StateMsgHandlerPost() -> ID = "+this.toString() );
			
			msgText = entity.getText();
		
			
		} catch (Exception e) {
			e.printStackTrace();
		}

		serveAndGetReturn( msgSupply, msgText);
		
		getResponse().commit();
		
		// we do not return anything for state messages
		return "";
		
	}
	
}
